Skip to content
This repository has been archived by the owner on Aug 21, 2020. It is now read-only.

Commit

Permalink
Moved testing data and scripts into 'testing' subdirectory
Browse files Browse the repository at this point in the history
  • Loading branch information
simoncadman committed Mar 9, 2014
1 parent b86ffe7 commit d8d2541
Show file tree
Hide file tree
Showing 26 changed files with 42 additions and 38 deletions.
2 changes: 1 addition & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ install: all
${INSTALL} ${srcdir}/full-test.sh ${prefix}/share/cloudprint-cups/
${INSTALL} ${srcdir}/remove-test.sh ${prefix}/share/cloudprint-cups/
unlink ${prefix}/share/cloudprint-cups/pre-commit.py
${INSTALL} -m 644 ${srcdir}/testfiles/* ${prefix}/share/cloudprint-cups/testfiles/
${INSTALL} -m 644 ${srcdir}/testing/* ${prefix}/share/cloudprint-cups/testing/
${INSTALL} -m 644 ${srcdir}/oauth2client/*.py ${prefix}/share/cloudprint-cups/oauth2client/
mkdir -p ${cupsbackend}
mkdir -p ${cupsdriver}
Expand Down
2 changes: 1 addition & 1 deletion backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
Utils.SetupLogging()

# line below is replaced on commit
CCPVersion = "20140308 200341"
CCPVersion = "20140309 220149"
Utils.ShowVersion(CCPVersion)

requestors, storage = Auth.SetupAuth(False)
Expand Down
2 changes: 1 addition & 1 deletion deleteaccount.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
Utils.SetupLogging()

# line below is replaced on commit
CCPVersion = "20140308 200341"
CCPVersion = "20140309 220149"
Utils.ShowVersion(CCPVersion)

while True:
Expand Down
2 changes: 1 addition & 1 deletion dynamicppd.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
Utils.SetupLogging()

# line below is replaced on commit
CCPVersion = "20140308 200341"
CCPVersion = "20140309 220149"
Utils.ShowVersion(CCPVersion)

def showUsage():
Expand Down
2 changes: 1 addition & 1 deletion listcloudprinters.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
Utils.SetupLogging()

# line below is replaced on commit
CCPVersion = "20140308 200341"
CCPVersion = "20140309 220149"
Utils.ShowVersion(CCPVersion)

requestors, storage = Auth.SetupAuth(True)
Expand Down
2 changes: 1 addition & 1 deletion listdrivefiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
Utils.SetupLogging()

# line below is replaced on commit
CCPVersion = "20140308 200341"
CCPVersion = "20140309 220149"
Utils.ShowVersion(CCPVersion)

requestors, storage = Auth.SetupAuth(True, permissions=['https://www.googleapis.com/auth/cloudprint', 'https://www.googleapis.com/auth/drive.readonly'])
Expand Down
20 changes: 10 additions & 10 deletions packages/freebsd/pkg-plist
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@ lib/cloudprint-cups/oauth2client/clientsecrets.py
lib/cloudprint-cups/oauth2client/crypt.py
lib/cloudprint-cups/oauth2client/locked_file.py
lib/cloudprint-cups/oauth2client/multistore_file.py
lib/cloudprint-cups/testfiles/NotPdf.txt
lib/cloudprint-cups/testfiles/Test Page.pdf
lib/cloudprint-cups/testfiles/Test Page.png
lib/cloudprint-cups/testfiles/testppd.ppd
lib/cloudprint-cups/testfiles/capabilitylist
lib/cloudprint-cups/testing/testfiles/NotPdf.txt
lib/cloudprint-cups/testing/testfiles/Test Page.pdf
lib/cloudprint-cups/testing/testfiles/Test Page.png
lib/cloudprint-cups/testing/testfiles/testppd.ppd
lib/cloudprint-cups/testing/testfiles/capabilitylist
lib/cloudprint-cups/testing/test_auth.py
lib/cloudprint-cups/testing/test_backend.py
lib/cloudprint-cups/testing/test_cloudprintrequestor.py
lib/cloudprint-cups/testing/test_mockrequestor.py
lib/cloudprint-cups/testing/test_printer.py
lib/cloudprint-cups/auth.py
lib/cloudprint-cups/backend.py
lib/cloudprint-cups/cloudprintrequestor.py
Expand All @@ -19,11 +24,6 @@ lib/cloudprint-cups/listcloudprinters.py
lib/cloudprint-cups/printer.py
lib/cloudprint-cups/reportissues.py
lib/cloudprint-cups/setupcloudprint.py
lib/cloudprint-cups/test_auth.py
lib/cloudprint-cups/test_backend.py
lib/cloudprint-cups/test_cloudprintrequestor.py
lib/cloudprint-cups/test_mockrequestor.py
lib/cloudprint-cups/test_printer.py
lib/cloudprint-cups/upgrade.py
@dirrm lib/cloudprint-cups/testfiles
@dirrm lib/cloudprint-cups/oauth2client
Expand Down
2 changes: 1 addition & 1 deletion packages/redhat/SPECS/cupscloudprint.spec
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ python2 -m compileall -q -f .
%attr(644, root, lp) %{_usr}/share/cloudprint-cups/oauth2client/*.pyo
%attr(644, root, lp) %{_usr}/share/cloudprint-cups/*.pyc
%attr(644, root, lp) %{_usr}/share/cloudprint-cups/*.pyo
%attr(644, root, lp) %{_usr}/share/cloudprint-cups/testfiles/*
%attr(644, root, lp) %{_usr}/share/cloudprint-cups/testing/*
%doc %{_usr}/share/cloudprint-cups/COPYING
%doc %{_usr}/share/cloudprint-cups/README.md

Expand Down
2 changes: 1 addition & 1 deletion reportissues.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
Utils.SetupLogging()

# line below is replaced on commit
CCPVersion = "20140308 200341"
CCPVersion = "20140309 220149"
Utils.ShowVersion(CCPVersion)

requestors, storage = Auth.SetupAuth(True)
Expand Down
2 changes: 1 addition & 1 deletion setupcloudprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
Utils.SetupLogging()

# line below is replaced on commit
CCPVersion = "20140308 200341"
CCPVersion = "20140309 220149"
Utils.ShowVersion(CCPVersion)

unattended = False
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions test_auth.py → testing/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import json, urllib, cups, os, stat, grp, pytest, logging, sys
sys.path.insert(0, ".")

from auth import Auth
import json, urllib, cups, os, stat, grp, pytest, logging
from test_mockrequestor import MockRequestor
from oauth2client import client
from oauth2client import multistore_file
from ccputils import Utils

def setup_function(function):
# setup mock requestors
global requestors
Expand Down
7 changes: 4 additions & 3 deletions test_ccputils.py → testing/test_ccputils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os, logging, sys, pytest
sys.path.insert(0, ".")

from ccputils import Utils
import os, logging, sys, pytest

def teardown_function(function):
logging.shutdown()
Expand Down Expand Up @@ -45,10 +46,10 @@ def test_SetupLoggingFails():
assert os.path.exists(testLogFile) == False

def test_fileIsPDFFails():
assert Utils.fileIsPDF('testfiles/NotPdf.txt') == False
assert Utils.fileIsPDF('testing/testfiles/NotPdf.txt') == False

def test_fileIsPDFSucceeds():
assert Utils.fileIsPDF('testfiles/Test Page.pdf') == True
assert Utils.fileIsPDF('testing/testfiles/Test Page.pdf') == True

def test_fileIsPDFErrors():
assert Utils.fileIsPDF("-dsadsa") == False
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import json, pytest, logging, sys
sys.path.insert(0, ".")

import json, pytest, logging
from cloudprintrequestor import cloudprintrequestor

global requestor
Expand Down
3 changes: 2 additions & 1 deletion test_mockrequestor.py → testing/test_mockrequestor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import json, urllib
import json, urllib, sys
sys.path.insert(0, ".")

class MockRequestor:

Expand Down
23 changes: 12 additions & 11 deletions test_printer.py → testing/test_printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import cups, urllib, logging, sys
sys.path.insert(0, ".")

from printer import Printer
from test_mockrequestor import MockRequestor
import cups, urllib, logging

global requestors, printerItem

Expand Down Expand Up @@ -206,7 +207,7 @@ def test_internalName():
# internalCapabilityTests.append( { 'name' : word } )

# load test file and try all those
for filelineno, line in enumerate(open('testfiles/capabilitylist')):
for filelineno, line in enumerate(open('testing/testfiles/capabilitylist')):
internalCapabilityTests.append( { 'name' : line.decode("utf-8") } )

for internalTest in internalCapabilityTests:
Expand Down Expand Up @@ -300,23 +301,23 @@ def test_printers():
assert isinstance(printerdetails['printers'][0]['capabilities'], list)

# test submitting job
assert printerItem.submitJob(printerId, 'pdf', 'testfiles/Test Page.pdf', 'Test Page', testprintername ) == True
assert printerItem.submitJob(printerId, 'pdf', 'testfiles/Test Page Doesnt Exist.pdf', 'Test Page', testprintername ) == False
assert printerItem.submitJob(printerId, 'pdf', 'testing/testfiles/Test Page.pdf', 'Test Page', testprintername ) == True
assert printerItem.submitJob(printerId, 'pdf', 'testing/testfiles/Test Page Doesnt Exist.pdf', 'Test Page', testprintername ) == False

# test submitting job with no name
assert printerItem.submitJob(printerId, 'pdf', 'testfiles/Test Page.pdf', '', testprintername ) == True
assert printerItem.submitJob(printerId, 'pdf', 'testfiles/Test Page Doesnt Exist.pdf', '', testprintername ) == False
assert printerItem.submitJob(printerId, 'pdf', 'testing/testfiles/Test Page.pdf', '', testprintername ) == True
assert printerItem.submitJob(printerId, 'pdf', 'testing/testfiles/Test Page Doesnt Exist.pdf', '', testprintername ) == False

# png
assert printerItem.submitJob(printerId, 'png', 'testfiles/Test Page.png', 'Test Page', testprintername ) == True
assert printerItem.submitJob(printerId, 'png', 'testfiles/Test Page Doesnt Exist.png', 'Test Page', testprintername ) == False
assert printerItem.submitJob(printerId, 'png', 'testing/testfiles/Test Page.png', 'Test Page', testprintername ) == True
assert printerItem.submitJob(printerId, 'png', 'testing/testfiles/Test Page Doesnt Exist.png', 'Test Page', testprintername ) == False

# ps
assert printerItem.submitJob(printerId, 'ps', 'testfiles/Test Page.ps', 'Test Page', testprintername ) == False
assert printerItem.submitJob(printerId, 'ps', 'testfiles/Test Page Doesnt Exist.ps', 'Test Page', testprintername ) == False
assert printerItem.submitJob(printerId, 'ps', 'testing/testfiles/Test Page.ps', 'Test Page', testprintername ) == False
assert printerItem.submitJob(printerId, 'ps', 'testing/testfiles/Test Page Doesnt Exist.ps', 'Test Page', testprintername ) == False

# test failure of print job
assert printerItem.submitJob(printerId, 'pdf', 'testfiles/Test Page.pdf', 'FAIL PAGE', testprintername ) == False
assert printerItem.submitJob(printerId, 'pdf', 'testing/testfiles/Test Page.pdf', 'FAIL PAGE', testprintername ) == False

# delete test printer
connection.deletePrinter( testprintername )
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
Utils.SetupLogging()

# line below is replaced on commit
CCPVersion = "20140308 200341"
CCPVersion = "20140309 220149"
Utils.ShowVersion(CCPVersion)

if not os.path.exists("/etc/cloudprint.conf"):
Expand Down

0 comments on commit d8d2541

Please sign in to comment.