l.a.t.t.TestPPAHtaccessTokenGeneration(TestCaseWithFactory) : class documentation

Part of lp.archivepublisher.tests.test_generate_ppa_htaccess View In Hierarchy

Test the generate_ppa_htaccess.py script.
Method setUp Undocumented
Method getScript Return a HtaccessTokenGenerator instance.
Method runScript Run the expiry script.
Method testEnsureHtaccess Ensure that the .htaccess file is generated correctly.
Method testGenerateHtpasswd Given some `ArchiveAuthToken`s, test generating htpasswd.
Method testReplaceUpdatedHtpasswd Test that the htpasswd file is only replaced if it changes.
Method assertDeactivated Helper function to test token deactivation state.
Method assertNotDeactivated Helper function to test token deactivation state.
Method setupSubscriptionsAndTokens Set up a few subscriptions and test tokens and return them.
Method testDeactivatingTokens Test that token deactivation happens properly.
Method setupDummyTokens Helper function to set up some tokens.
Method ensureNoFiles Ensure the .ht* files don't already exist.
Method testSubscriptionExpiry Ensure subscriptions' statuses are set to EXPIRED properly.
Method testBasicOperation Invoke the actual script and make sure it generates some files.
Method testBasicOperation_with_named_tokens Invoke the actual script and make sure it generates some files.
Method testDryrunOption Test that the dryrun and no-deactivation option works.
Method testNoDeactivationOption Test that the --no-deactivation option works.
Method testBlacklistingPPAs Test that the htaccess for blacklisted PPAs are not touched.
Method testSkippingOfDisabledPPAs Test that the htaccess for disabled PPAs are not touched.
Method testSkippingOfDeletedPPAs Test that the htaccess for deleted PPAs are not touched.
Method testSendingCancellationEmail Test that when a token is deactivated, its user gets an email.
Method testNoEmailOnCancellationForSuppressedArchive No email should be sent if the archive has
Method test_getTimeToSyncFrom Undocumented
Method test_getNewPrivatePPAs_no_previous_run Undocumented
Method test_getNewPrivatePPAs_only_those_since_last_run Undocumented
Method test_getNewTokens_no_previous_run All valid tokens returned if there is no record of previous run.
Method test_getNewTokens_only_those_since_last_run Only tokens created since the last run are returned.
Method test_getNewTokens_only_active_tokens Only active tokens are returned.
Method test_getDeactivatedNamedTokens_no_previous_run All deactivated named tokens returned if there is no record
Method test_getDeactivatedNamedTokens_only_those_since_last_run Only named tokens deactivated since last run are returned.
Method test_processes_PPAs_without_subscription Undocumented
Method _setupOptionsData Setup test data for option testing.

Inherited from TestCaseWithFactory:

Method getUserBrowser Return a Browser logged in as a fresh user, maybe opened at url.
Method getNonRedirectingBrowser Undocumented
Method createBranchAtURL Create a branch at the supplied URL.
Method create_branch_and_tree Create a database branch, bzr branch and bzr checkout.
Method createBzrBranch Create a bzr branch for a database branch.
Static Method getBranchPath Return the path of the branch in the mirrored area.
Method useTempBzrHome Undocumented
Method useBzrBranches Prepare for using bzr branches.

Inherited from TestCase (via TestCaseWithFactory):

Method becomeDbUser Commit, then log into the database as dbuser.
Method __str__ The string representation of a test is its id.
Method useContext Use the supplied context in this test.
Method makeTemporaryDirectory Create a temporary directory, and return its path.
Method installKarmaRecorder Set up and return a KarmaRecorder.
Method assertProvides Assert 'obj' correctly provides 'interface'.
Method assertNotifies Assert that a callable performs a given notification.
Method assertNoNotification Assert that no notifications are generated by the callable.
Method assertSqlAttributeEqualsDate Fail unless the value of the attribute is equal to the date.
Method assertTextMatchesExpressionIgnoreWhitespace Undocumented
Method assertIsInstance Assert that an instance is an instance of assert_class.
Method assertIsNot Assert that expected is not the same object as observed.
Method assertContentEqual Assert that 'iter1' has the same content as 'iter2'.
Method assertRaisesWithContent Check if the given exception is raised with given content.
Method assertBetween Assert that 'variable' is strictly between two boundaries.
Method assertVectorEqual Apply assertEqual to all given pairs in one go.
Method expectedLog Expect a log to be written that matches the regex.
Method pushConfig Push some key-value pairs into a section of the config.
Method attachOopses Undocumented
Method attachLibrarianLog Include the logChunks from fixture in the test details.
Method assertStatementCount Assert that the expected number of SQL statements occurred.
Method useTempDir Use a temporary directory for this test.
Method assertEmailHeadersEqual Assert that two email headers are equal.
Method assertStartsWith Undocumented
Method assertEndsWith Asserts that s ends with suffix.
Method checkPermissions Check if the used_permissions match expected_permissions.
Method assertEmailQueueLength Pop the email queue, assert its length, and return it.
Method _unfoldEmailHeader Unfold a multiline email header.
def setUp(self):
Undocumented
def getScript(self, test_args=None):
Return a HtaccessTokenGenerator instance.
def runScript(self):
Run the expiry script.
Returnsa tuple of return code, stdout and stderr.
def testEnsureHtaccess(self):
Ensure that the .htaccess file is generated correctly.
def testGenerateHtpasswd(self):
Given some `ArchiveAuthToken`s, test generating htpasswd.
def testReplaceUpdatedHtpasswd(self):
Test that the htpasswd file is only replaced if it changes.
def assertDeactivated(self, token):
Helper function to test token deactivation state.
def assertNotDeactivated(self, token):
Helper function to test token deactivation state.
def setupSubscriptionsAndTokens(self):
Set up a few subscriptions and test tokens and return them.
def testDeactivatingTokens(self):
Test that token deactivation happens properly.
def setupDummyTokens(self):
Helper function to set up some tokens.
def ensureNoFiles(self):
Ensure the .ht* files don't already exist.
def testSubscriptionExpiry(self):
Ensure subscriptions' statuses are set to EXPIRED properly.
def testBasicOperation(self):
Invoke the actual script and make sure it generates some files.
def testBasicOperation_with_named_tokens(self):
Invoke the actual script and make sure it generates some files.
def _setupOptionsData(self):
Setup test data for option testing.
def testDryrunOption(self):
Test that the dryrun and no-deactivation option works.
def testNoDeactivationOption(self):
Test that the --no-deactivation option works.
def testBlacklistingPPAs(self):
Test that the htaccess for blacklisted PPAs are not touched.
def testSkippingOfDisabledPPAs(self):
Test that the htaccess for disabled PPAs are not touched.
def testSkippingOfDeletedPPAs(self):
Test that the htaccess for deleted PPAs are not touched.
def testSendingCancellationEmail(self):
Test that when a token is deactivated, its user gets an email.

The email must contain the right headers and text.

def testNoEmailOnCancellationForSuppressedArchive(self):
No email should be sent if the archive has suppress_subscription_notifications set.
def test_getTimeToSyncFrom(self):
Undocumented
def test_getNewPrivatePPAs_no_previous_run(self):
Undocumented
def test_getNewPrivatePPAs_only_those_since_last_run(self):
Undocumented
def test_getNewTokens_no_previous_run(self):
All valid tokens returned if there is no record of previous run.
def test_getNewTokens_only_those_since_last_run(self):
Only tokens created since the last run are returned.
def test_getNewTokens_only_active_tokens(self):
Only active tokens are returned.
def test_getDeactivatedNamedTokens_no_previous_run(self):
All deactivated named tokens returned if there is no record of previous run.
def test_getDeactivatedNamedTokens_only_those_since_last_run(self):
Only named tokens deactivated since last run are returned.
def test_processes_PPAs_without_subscription(self):
Undocumented
API Documentation for Launchpad, generated by pydoctor at 2018-02-22 00:00:13.