Esempio n. 1
0
    def test_01_Name(self):
        HEADING()

        n = Name(experiment="exp",
                 group="grp",
                 user="******",
                 kind="vm",
                 counter=1)

        n.reset()
        assert n.counter == 1

        print(n)
        assert str(n) == "exp-grp-gregor-vm-1"

        pprint(n.dict())

        print(n.get("container"))
        print(n)
        assert str(n) == "exp-grp-gregor-container-1"

        n.incr()
        print(n)
        assert str(n) == "exp-grp-gregor-container-2"

        print(n.counter)
        assert n.counter == 2

        m = Name()

        pprint(n.dict())
        pprint(m.dict())
        print(m)
        assert str(n) == str(m)
Esempio n. 2
0
    def test_define(self):
        HEADING()
        Benchmark.Start()
        n = Name(**data)
        Benchmark.Stop()

        VERBOSE(data)
        VERBOSE(n.dict())
        assert dict(data) == n.dict()
Esempio n. 3
0
 def test_name_dict(self):
     HEADING()
     n = Name()
     pprint(n.dict())
     Benchmark.Start()
     data = n.dict()
     Benchmark.Stop()
     assert data == dict({
         'schema': '{user}-{kind}-{counter}',
         'counter': 1,
         'user': username,
         'kind': 'vm'})
Esempio n. 4
0
 def test_name_dict(self):
     n = Name()
     pprint(n.dict())
     Benchmark.Start()
     data = n.dict()
     Benchmark.Stop()
     assert data == dict({
         'counter': 1,
         'kind': 'vm',
         'path': '/Users/grey/.cloudmesh/name.yaml',
         'schema': '{user}-{kind}-{counter}',
         'user': '******'
     })
Esempio n. 5
0
    def test_name_counter(self):
        n = Name()
        Benchmark.Start()
        c = n.counter
        Benchmark.Stop()
        print(n.counter)
        assert n.counter == 2

        m = Name()

        pprint(n.dict())
        pprint(m.dict())
        print(m)
        assert str(n) == str(m)
Esempio n. 6
0
    def test_define_new(self):
        HEADING()
        os.remove(path)

        Benchmark.Start()
        n = Name(schema="{user}-{kind}-{counter}",
                 counter="3",
                 user=username,
                 kind="vm")
        Benchmark.Stop()
        data = n.dict()
        pprint(data)
        assert data == dict({
            'schema': '{user}-{kind}-{counter}',
            'counter': 3,
            'user': username,
            'kind': 'vm'})
Esempio n. 7
0
    def test_define_new(self):
        os.remove(path)

        Benchmark.Start()
        n = Name(schema="{user}-{kind}-{counter}",
                 counter="3",
                 user="******",
                 kind="vm")
        Benchmark.Stop()
        data = n.dict()
        pprint(data)
        assert data == dict({
            'counter': 3,
            'kind': 'vm',
            'path': '/Users/grey/.cloudmesh/name.yaml',
            'schema': '{user}-{kind}-{counter}',
            'user': '******'
        })
Esempio n. 8
0
 def test_define(self):
     Benchmark.Start()
     n = Name()
     Benchmark.Stop()
     assert dict(data) == n.dict()