Exemplo n.º 1
0
 def test_advanced_bad_state(self, db_session, create_user):
     """Test with a non-States state value
     """
     ds = Dataset(owner=create_user.username,
                  controller="frodo",
                  name="fio")
     ds.add()
     with pytest.raises(DatasetBadParameterType):
         ds.advance("notStates")
Exemplo n.º 2
0
 def test_advanced_good(self, db_session, create_user):
     """ Test advancing the state of a dataset
     """
     ds = Dataset(owner=create_user.username,
                  controller="frodo",
                  name="fio")
     ds.add()
     ds.advance(States.UPLOADED)
     assert ds.state == States.UPLOADED
     assert ds.created <= ds.transition
Exemplo n.º 3
0
    def test_attach_filename(self, db_session, create_user):
        """ Test that we can create a dataset using the full tarball
        file path.
        """
        ds1 = Dataset(owner="test",
                      path="/foo/bilbo/rover.tar.xz",
                      state=States.QUARANTINED)
        ds1.add()

        ds2 = Dataset.attach(controller="bilbo", name="rover")
        assert ds2.owner == ds1.owner
        assert ds2.controller == ds1.controller
        assert ds2.name == ds1.name
        assert ds2.state == States.QUARANTINED
        assert ds2.md5 is ds1.md5
        assert ds2.id is ds1.id
Exemplo n.º 4
0
    def test_attach_controller_path(self, db_session, create_user):
        """ Test that we can attach using controller and name to a
        dataset created by file path.
        """
        ds1 = Dataset(
            owner=create_user.username,
            path="/foo/frodo/fio.tar.xz",
            state=States.INDEXING,
        )
        ds1.add()

        ds2 = Dataset.attach(controller="frodo", name="fio")
        assert ds2.owner == ds1.owner
        assert ds2.controller == ds1.controller
        assert ds2.name == ds1.name
        assert ds2.state == States.INDEXING
        assert ds2.md5 is ds1.md5
        assert ds2.id is ds1.id