コード例 #1
0
ファイル: tests.py プロジェクト: ltucker/radarpost
    def test_mailbox_create(self):
        """
        test creating a mailbox
        """
        try:
            slug = self.TEST_MAILBOX_SLUG + '_test_mailbox_create'
            mb_url = self.url_for('mailbox_rest', mailbox_slug=slug)
            assert get_mailbox(self.config, slug) is None
            
            c = self.get_test_app()
            self.login_as_admin(c)
            
            c.head(mb_url, status=404)
            c.put(mb_url, '{}', content_type="application/json", status=201)
            c.head(mb_url, status=200)

            
            mb = get_mailbox(self.config, slug)
            assert mb is not None
            assert is_mailbox(mb)
        finally:
            dbname = get_database_name(self.config, slug)
            couchdb = get_couchdb_server(self.config)
            if dbname in couchdb: 
                del couchdb[dbname]
コード例 #2
0
ファイル: tests.py プロジェクト: ltucker/radarpost
 def tearDown(self):
     couchdb = get_couchdb_server(self.config)
     dbname = get_database_name(self.config, self.TEST_MAILBOX_SLUG)
     if dbname in couchdb:
         del couchdb[dbname]