~hazmat/pyjuju/local-network

« back to all changes in this revision

Viewing changes to ensemble/providers/lxc/tests/test_machine.py

  • Committer: kapil.thangavelu at canonical
  • Date: 2011-09-14 22:35:17 UTC
  • mfrom: (340.1.8 local-machine)
  • Revision ID: kapil.thangavelu@canonical.com-20110914223517-puf49nm4ob29zb9s
Merged local-machine into local-network.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
import datetime
2
 
 
3
1
from ensemble.providers.lxc.machine import LocalMachine
4
 
 
5
2
from ensemble.lib.testing import TestCase
6
3
 
7
4
 
9
6
 
10
7
    def test_machine_attributes(self):
11
8
 
12
 
        uptime_file_path = self.makeFile("1000000 5000")
13
 
        self.patch(LocalMachine, "uptime_file", uptime_file_path)
14
 
 
15
 
        now = datetime.datetime.now()
16
 
        mock_date = self.mocker.mock()
17
 
        self.patch(datetime, "datetime", mock_date)
18
 
        mock_date.now()
19
 
        self.mocker.result(now)
20
 
        self.mocker.replay()
21
 
 
22
9
        machine = LocalMachine()
23
10
        self.assertEqual(machine.instance_id, "local")
24
11
        self.assertEqual(machine.dns_name, "localhost")
25
 
        self.assertEqual(
26
 
            machine.launch_time,
27
 
            now - datetime.timedelta(seconds=1000000))
 
12
        self.assertEqual(machine.private_dns_name, "localhost")