コード例 #1
0
    def test_populate_database_non_existent_model(self):
        # given
        item = Mock()
        item.type = 'random'
        item.properties = ['']
        items = [item]

        # then
        with self.assertRaises(NonExistentModelException):
            populate_database(items)
コード例 #2
0
    def test_populate_database_non_existent_model(self):
        # given
        item = Mock()
        item.type = 'random'
        item.properties = ['']
        items = [item]

        # then
        with self.assertRaises(NonExistentModelException):
            populate_database(items)
コード例 #3
0
    def test_populate_database_add_project(self):
        # given
        item = Mock()
        item.type = 'project'
        item.properties = ['title', 'filename', 'techno', 'url', 1]
        items = [item]

        # when
        populate_database(items)

        # then
        self.assert_project_with_title_exists_in_database(item.properties[0])
コード例 #4
0
    def test_populate_database_add_technology(self):
        # given
        item = Mock()
        item.type = 'technology'
        item.properties = ['techno_txt']
        items = [item]

        # when
        populate_database(items)

        # then
        self.assert_technology_with_name_exists_in_database(item.properties[0])
コード例 #5
0
    def test_populate_database_add_status(self):
        # given
        item = Mock()
        item.type = 'status'
        item.properties = ['status_txt']
        items = [item]

        # when
        populate_database(items)

        # then
        self.assert_status_with_name_exists_in_database(item.properties[0])
コード例 #6
0
    def test_populate_database_add_user(self):
        # given
        item = Mock()
        item.type = 'user'
        item.properties = ['bob', '*****@*****.**', 'bobpw']
        items = [item]

        # when
        populate_database(items)

        # then
        self.assert_user_with_username_exists_in_database(item.properties[0])
コード例 #7
0
    def test_populate_database_add_project(self):
        # given
        item = Mock()
        item.type = 'project'
        item.properties = ['title', 'filename', 'techno', 'url', 1]
        items = [item]

        # when
        populate_database(items)

        # then
        self.assert_project_with_title_exists_in_database(item.properties[0])
コード例 #8
0
    def test_populate_database_add_technology(self):
        # given
        item = Mock()
        item.type = 'technology'
        item.properties = ['techno_txt']
        items = [item]

        # when
        populate_database(items)

        # then
        self.assert_technology_with_name_exists_in_database(item.properties[0])
コード例 #9
0
    def test_populate_database_add_status(self):
        # given
        item = Mock()
        item.type = 'status'
        item.properties = ['status_txt']
        items = [item]

        # when
        populate_database(items)

        # then
        self.assert_status_with_name_exists_in_database(item.properties[0])
コード例 #10
0
    def test_populate_database_add_user(self):
        # given
        item = Mock()
        item.type = 'user'
        item.properties = ['bob', '*****@*****.**', 'bobpw']
        items = [item]

        # when
        populate_database(items)

        # then
        self.assert_user_with_username_exists_in_database(item.properties[0])
コード例 #11
0
    def test_populate_database_add_post(self):
        # given
        item = Mock()
        item.type = 'post'
        item.properties = ['title', 'filename', datetime.now(), 'category', 'author']
        items = [item]

        # when
        populate_database(items)

        # then
        self.assert_post_with_title_exists_in_database(item.properties[0])
コード例 #12
0
    def test_populate_database_add_post(self):
        # given
        item = Mock()
        item.type = 'post'
        item.properties = [
            'title', 'filename',
            datetime.now(), 'category', 'author'
        ]
        items = [item]

        # when
        populate_database(items)

        # then
        self.assert_post_with_title_exists_in_database(item.properties[0])